$("#login").click(function () {
    var user = $("#user").val();
    var pass = $("#pass").val();
    // alert(user+","+pass);
    // alert($("input[type='checkbox']").attr('checked'));
    // alert($("input[type='checkbox']").prop('checked'));
});

$("#user").blur(function(){
    $("#user").empty();
    var name = $(this).val();
    if(name=="" || name==null){
        $("#names").html("用户名不能为空");
    }else {
        $("#names").html("");
    }
});

// 注册
$("#register").click(function () {
    var userName = $("#userName").val();
    var userLogin = $("#userLogin").val();
    var userPassword = $("#userPassword").val();
    var idCard = $("#idCard").val();
    var phone = $("#phone").val();

    var da = {"userName":userName,"userLogin":userLogin,"userPassword":userPassword,"idCard":idCard,"phone":phone};
    // $.get("http://localhost:8080/patient/zuche",function(result){
    //     console.log(result);
    // },"application/json");
    $.ajax({
        type : "POST",
        url : "http://localhost:8080/patient/zuche",
        data : JSON.stringify(da),
        contentType : "application/json",              //发送至服务器的类型   
        dataType : "json",                                     //预期服务器返回类型  
        success : function(data) {
            // alert(data)
            if(data == true){
                $(location).prop('href', '../zuche/index.jsp');
            }else {
                $("#zc").html("注册失败");
            }
        },error:function(data){
            alert(data);
        }
    });
});

